package com.yy.wga.user.service.controller;

import com.yy.wga.common.core.dto.Result;
import com.yy.wga.common.util.mapping.BeansUtils;
import com.yy.wga.user.feign.api.UserBurialPointFeign;
import com.yy.wga.user.feign.request.SaveUserBurialPointReq;
import com.yy.wga.user.service.pojo.UserBurialPointBO;
import com.yy.wga.user.service.service.UserBurialPointService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author lgw
 * @version JDK 8
 * @date 2025/2/24
 * @description 用户埋点
 */
@RestController
@RequestMapping(value = "/api/user/burial/point/")
public class UserBurialPointController implements UserBurialPointFeign {
    @Resource
    private UserBurialPointService service;

    @Override
    @PostMapping("save")
    public Result<Boolean> burialPoint(@Validated @RequestBody SaveUserBurialPointReq request) {
        UserBurialPointBO saveBO = BeansUtils.map(request, UserBurialPointBO.class);
        saveBO.setAppKey(request.getAppKey());
        service.save(saveBO);
        return Result.success(Boolean.TRUE);
    }
}
